Region-based memory management for Mercury programs

نویسندگان

  • Quan Phan
  • Gerda Janssens
  • Zoltan Somogyi
چکیده

Region-based memory management (RBMM) is a form of compile time memory management, well-known from the functional programming world. In this paper we describe our work on implementing RBMM for the logic programming language Mercury. One interesting point about Mercury is that it is designed with strong type, mode, and determinism systems. These systems not only provide Mercury programmers with several direct software engineering benefits, such as self-documenting code and clear program logic, but also give language implementors a large amount of information that is useful for program analyses. In this work, we make use of this information to develop program analyses that determine the distribution of data into regions and transform Mercury programs by inserting into them the necessary region operations. We prove the correctness of our program analyses and transformation. To execute the annotated programs, we have implemented runtime support that tackles the two main challenges posed by backtracking. First, backtracking can require regions removed during forward execution to be “resurrected”; and second, any memory allocated during a computation that has been backtracked over must be recovered promptly and without waiting for the regions involved to come to the end of their life. We describe in detail our solution of both these problems. We study in detail how our RBMM system performs on a selection of benchmark programs, including some well-known difficult cases for RBMM. Even with these difficult cases, our RBMM-enabled Mercury system obtains clearly faster runtimes for 15 out of 18 benchmarks compared to the base Mercury system with its Boehm runtime garbage collector, with an average runtime speedup of 24%, and an average reduction in memory requirements of 95%. In fact, our system achieves optimal memory consumption in some programs.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Towards Region-Based Memory Management for Mercury Programs

Region-based memory management is a form of compiletime memory management, well-known from the functional programming world. This paper describes region-based memory management for the Mercury language using some points-to graphs that model the partition of the memory used by a program into separate regions and distribute the values of the program’s variables over the regions. First, a region a...

متن کامل

More Precise Region-Based Memory Management for Mercury Programs

Dividing the heap memory of programs into regions is the starting point of region-based memory management. In our existing work of enabling region-based memory management for Mercury, a program analysis was used to distribute data over the regions. An important goal of the analysis is to decide which program variables should end up in the same region. For a popular class of programs, it covetou...

متن کامل

Static Region Analysis for Mercury

Region-based memory management is a form of compiletime memory management, well-known from the functional programming world. This paper describes a static region analysis for the logic programming language Mercury. We use region points-to graphs to model the partitioning of the memory used by a program into separate regions. The algorithm starts with a region points-to analysis that determines ...

متن کامل

Static Memory Management for Logic Programming Languages

Introduction. Logic programming (LP) languages aim to free programmers from procedural details such as memory management tasks. One classical, automatic memory management technique in logic programming is to use a heap memory for all the structured terms and rely on backtracking and on a runtime garbage collector to reclaim memory. While efficient implementation of garbage collectors for LP lan...

متن کامل

Region-based Memory for CLI

Region-based memory management can offer increased time performance, providing support for real-time constraints in program execution. We have implemented region-based memory support into the SSCLI 2.0 platform and also devised a region inference system for CIL programs, with the aid of newly introduced instructions. Results seem promising, as the programs running with regions have considerably...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • TPLP

دوره 13  شماره 

صفحات  -

تاریخ انتشار 2013